Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BI-4975: Construct file-connector s3 path dynamically #31

Merged
merged 2 commits into from
Oct 24, 2023

Conversation

asnytin
Copy link
Contributor

@asnytin asnytin commented Oct 19, 2023

No description provided.

@asnytin asnytin force-pushed the asnytin/s3_filename_suffix branch from e1b1fcf to 23b2d1e Compare October 19, 2023 23:47
Comment on lines 125 to 127
def get_full_s3_filename(self, s3_filename_suffix: Optional[str]) -> Optional[str]:
if s3_filename_suffix is None:
return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Optional (both in arguments and in return type)? I can't see any calls where either can be None (except for tests)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now s3_filename_suffix will be loaded as None for old connections until migration.
After migration Optional should be removed (with this fallback

if origin_src.s3_filename_suffix is not None:
s3_filename = self.connection.get_full_s3_filename(origin_src.s3_filename_suffix)
else:
# TODO: Remove this fallback after old connections migration to s3_filename_suffix
s3_filename = origin_src.s3_filename
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly, it is tested against being None here in the line 120 before the get_full_s3_filename call

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, you are right, I can remove Optionals from the method. But actually it's just a copy of old property src.s3_filename signature that can be None if save task haven't succeeded yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder for all of us, that this check will have to be moved above the fallback after the latter is removed

if status != FileProcessingStatus.ready or raw_schema is None or s3_filename is None:
raise exc.MaterializationNotFinished

@asnytin asnytin force-pushed the asnytin/s3_filename_suffix branch from 23b2d1e to ef3cd86 Compare October 24, 2023 12:59
@asnytin asnytin merged commit c278a71 into main Oct 24, 2023
6 of 9 checks passed
@asnytin asnytin deleted the asnytin/s3_filename_suffix branch October 24, 2023 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants